#! /bin/bash
export LANG=zh_CN.UTF-8
HIVE_HOME=/usr/bin/hive


${HIVE_HOME} -S -e "

create database if not exists edu_dws;
use edu_dws;

drop table if exists edu_dws.ydh_dws_check_wide_timecnt;
create table edu_dws.ydh_dws_check_wide_timecnt(
	create_date			   string			comment '创建时间',
	class_id               int 				comment '班级id',	
	time_type			   string			comment '时间段标签，am 每天上午，pm 每天下午，nt 每天晚上',
    dt           		   string  			comment '签到打卡日期',
	studying_cnt		   bigint  			comment '出勤人数',	
	late_cnt			   bigint  			comment '迟到人数',
	leave_cnt			   bigint  			comment '请假人数'
)
comment '考勤分析每日各时间段统计表'
row format delimited
fields terminated by '\t'
stored as orc tblproperties('orc.compress'='snappy')
;
"
a=$?
if [ ${a} -eq 0 ];then 
	echo 'Program running status return code:' ${a}
	echo '=============================打完收工！=============================='
else 
	echo 'Program running status return code:' ${a}
	echo '=============================程序出BUG咯！=============================='
	fi